home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 326-350 / disk_337 / cmanual / screens.lzh / Screens / Example4.c < prev    next >
C/C++ Source or Header  |  1990-01-30  |  4KB  |  123 lines

  1. /* Example4                                                            */
  2. /* This program will open two screens, one (low-resolution 32 colours) */
  3. /* at the top of the display, and the other one (high-resolution 16    */
  4. /* colours) a bit further down.                                        */
  5.  
  6.  
  7.  
  8. /* If your program is using Intuition you should include intuition.h: */
  9. #include <intuition/intuition.h>
  10.  
  11.  
  12.  
  13. struct IntuitionBase *IntuitionBase;
  14.  
  15.  
  16.  
  17. /* Declare two pointer to a Screen structure: */ 
  18. struct Screen *my_screen1;
  19. struct Screen *my_screen2;
  20.  
  21. /* Declare and initialize your NewScreen structure for screen 1: */
  22. struct NewScreen my_new_screen1=
  23. {
  24.   0,            /* LeftEdge  Should always be 0. */
  25.   0,            /* TopEdge   Top of the display.*/
  26.   320,          /* Width     We are using a low-resolution screen. */
  27.   100,          /* Height    */
  28.   5,            /* Depth     32 colours. */
  29.   0,            /* DetailPen Text should be drawn with colour reg. 0 */
  30.   1,            /* BlockPen  Blocks should be drawn with colour reg. 1 */
  31.   NULL,         /* ViewModes No special modes. (Low-res, Non-Interlaced) */
  32.   CUSTOMSCREEN, /* Type      Your own customized screen. */
  33.   NULL,         /* Font      Default font. */
  34.   "MY SCREEN1", /* Title     The screen' title. */
  35.   NULL,         /* Gadget    Must for the moment be NULL. */
  36.   NULL          /* BitMap    No special CustomBitMap. */
  37. };
  38.  
  39. /* Declare and initialize your NewScreen structure for screen 2: */
  40. struct NewScreen my_new_screen2=
  41. {
  42.   0,            /* LeftEdge  Should always be 0. */
  43.   105,          /* TopEdge   Top of the display.*/
  44.   640,          /* Width     We are using a low-resolution screen. */
  45.   95,           /* Height    */
  46.   4,            /* Depth     16 colours. */
  47.   0,            /* DetailPen Text should be drawn with colour reg. 0 */
  48.   1,            /* BlockPen  Blocks should be drawn with colour reg. 1 */
  49.   HIRES,        /* ViewModes High-resolution, Non-Interlaced */
  50.   CUSTOMSCREEN, /* Type      Your own customized screen. */
  51.   NULL,         /* Font      Default font. */
  52.   "MY SCREEN2", /* Title     The screen' title. */
  53.   NULL,         /* Gadget    Must for the moment be NULL. */
  54.   NULL          /* BitMap    No special CustomBitMap. */
  55. };
  56.  
  57.  
  58.  
  59. main()
  60. {
  61.   /* Open the Intuition Library: */
  62.   IntuitionBase = (struct IntuitionBase *)
  63.     OpenLibrary( "intuition.library", 0 );
  64.   
  65.   if( IntuitionBase == NULL )
  66.     exit(); /* Could NOT open the Intuition Library! */
  67.   
  68.  
  69.  
  70.   /* We will now try to open the first screen: */
  71.   my_screen1 = (struct Screen *) OpenScreen( &my_new_screen1 );
  72.   
  73.   /* Have we opened screen1 succesfully? */
  74.   if(my_screen1 == NULL)
  75.   {
  76.     /* Could NOT open the Screen1! */
  77.     
  78.     /* Close the Intuition Library since we have opened it: */
  79.     CloseLibrary( IntuitionBase );
  80.  
  81.     exit();  
  82.   }
  83.  
  84.  
  85.  
  86.   /* We will now try to open the second screen: */
  87.   my_screen2 = (struct Screen *) OpenScreen( &my_new_screen2 );
  88.   
  89.   /* Have we opened screen2 succesfully? */
  90.   if(my_screen2 == NULL)
  91.   {
  92.     /* Could NOT open Screen2! */
  93.     
  94.     /* Close Screen1 before we leave since we have opened it: */
  95.     CloseScreen( my_screen1 );
  96.     
  97.     /* Close the Intuition Library since we have opened it: */
  98.     CloseLibrary( IntuitionBase );
  99.  
  100.     exit();  
  101.   }
  102.  
  103.  
  104.  
  105.   /* We have opened the screens, and everything seems to be OK. */
  106.   /* Wait for 30 seconds: */
  107.   Delay( 50 * 30);
  108.  
  109.  
  110.  
  111.   /* We should always close the screens we have opened before we leave: */
  112.   CloseScreen( my_screen2 );
  113.   CloseScreen( my_screen1 );
  114.  
  115.  
  116.   
  117.   /* Close the Intuition Library since we have opened it: */
  118.   CloseLibrary( IntuitionBase );
  119.   
  120.   /* THE END */
  121. }
  122.  
  123.